/**
 * 2016，thor.com，all rights reserved。
 * 
 * Project：		palmmall-core
 * Filename：	SAuthenInfoConverter.java
 * Created：		2016年7月30日
 * Creator：		wolv
 */
package com.thor.palmmall.rest.hdmall.user.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.hdmall.user.HDMUserAuthParam;
import com.thor.palmmall.rest.hdmall.user.MAuthenInfo;
/**
 * @author:liyang
 * @time:2017年7月25日 下午4:15:19
 * @since:1.0
 */
public class MAuthenInfoConverter implements Converter<MAuthenInfo, HDMUserAuthParam> {

  public static MAuthenInfoConverter getInstance() {
    if (instance == null)
      instance = new MAuthenInfoConverter();
    return instance;
  }

  private static MAuthenInfoConverter instance;

  private MAuthenInfoConverter() {
  }

  @Override
  public HDMUserAuthParam convert(MAuthenInfo source) {
    if (source == null)
      return null;

    HDMUserAuthParam target = new HDMUserAuthParam();
    target.setPassword(source.getPassword());
    target.setPrincipal(source.getPrincipal());
    target.setType(source.getType());
    return target;
  }
}
